import React from 'react';
import { inject, observer } from 'mobx-react';
import { Button,Modal } from 'antd';
const confirm = Modal.confirm;
import {toJS} from "mobx";
import {Condition,getAdButtons} from '../list/listCondition';
import {WeaTableNew} from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
import {WeaRightMenu,WeaTop,WeaTab,WeaErrorPage,WeaTools,WeaLeftRightLayout,WeaAuth} from 'ecCom';
import ListLeftTree from '../list/listLeftTree'
import CptEdit from '../public/cptEdit'
import CptRecordDialog from '../public/cptRecordDialog'
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

@inject('cptSearchStore','mineCptStore')
@observer
class SearchResult extends React.Component {
    constructor(props) {
        super(props);
        window._cptTable = {
            reLoadTree: props.cptSearchStore.initTreeDatas
        }
    }
    componentWillMount(){
        const { location:{query},cptSearchStore } = this.props;
        if(!query.from){//人力我的资产、门户搜索传参
            if(query.name||query.hrmid){
                cptSearchStore.initDatas({...query,isdata:2});
            }else{
                cptSearchStore.initDatas(query);
            }
        }else{
            cptSearchStore.initDatas(query);
        }
        cptSearchStore.doSearch();
        cptSearchStore.initTreeDatas();
        cptSearchStore.initRightMenu();
    }

    componentWillReceiveProps(nextProps){
        const keyOld = this.props.location.key;
        const keyNew = nextProps.location.key;
        const queryOld = this.props.location.query;
        const queryNew = nextProps.location.query;
        //点击菜单路由刷新组件
        const { cptSearchStore } = nextProps;
		if(keyOld !== keyNew||queryOld !== queryNew) {
            cptSearchStore.clearStatus();
            cptSearchStore.resetForm();
            if(!queryNew.from){
                if(queryNew.name||queryNew.hrmid){
                    cptSearchStore.initDatas({...queryNew,isdata:2});
                }else{
                    cptSearchStore.initDatas(queryNew);
                }
            }
            cptSearchStore.doSearch();
            cptSearchStore.initTreeDatas();
            cptSearchStore.initRightMenu();
        }
    }

    componentWillUnmount(){
        const { cptSearchStore } = this.props;
        cptSearchStore.clearStatus();
        cptSearchStore.resetForm();
    }
    render(){
        const {cptSearchStore,mineCptStore} = this.props;
        const {loading,tableStore,showSearchAd,form,conditiontype,shareStore,reLoad,isdata,leftShow,showLeftTree,appDetachDisableAll} = cptSearchStore;
        const {showFlowModify,showType,showEditDialog} = mineCptStore;
        const formParams = form.getFormParams() || {};
        let _title = getLabel(15806,"资产信息");
		if(conditiontype.isdata==1){
			_title =  getLabel(1509,"资产资料")+getLabel(87,"信息");
        }
        let title = "";
        if(isdata == "1"){
            title = getLabel(33182,"查询资产资料");
        }else{
            title = getLabel(16425,"查询资产");
        };
        let shareCondition = [
            {
                "colSpan": 2,
                "conditionType": "SELECT",
                "domkey": [
                    "sharetype"
                ],
                "fieldcol": 16,
                "isQuickSearch": false,
                "label": getLabel( 21956 ,"对象类型"),
                "labelcol": 7,
                "options": [
                    {
                        "key": "1",
                        "selected": true,
                        "showname": getLabel(179,"人力资源")
                    }, {
                        "key": "5",
                        "selected": false,
                        "showname": getLabel(141,"分部")
                    }, {
                        "key": "2",
                        "selected": false,
                        "showname": getLabel(124,"部门")
                    }, {
                        "key": "11",
                        "selected": false,
                        "showname": getLabel(6086,"岗位")
                    }, {
                        "key": "3",
                        "selected": false,
                        "showname": getLabel(122,"角色")
                    }, {
                        "key": "4",
                        "selected": false,
                        "showname": getLabel(1340,"所有人")
                    }
                ],
                "viewAttr": 2
            }, {
                "2": [[
                        {
                            "browserConditionParam": {
                                "completeParams": {},
                                "conditionDataParams": {},
                                "dataParams": {},
                                "destDataParams": {},
                                "hasAddBtn": false,
                                "hasAdvanceSerach": true,
                                "idSeparator": ",",
                                "isAutoComplete": 1,
                                "isDetail": 0,
                                "isMultCheckbox": false,
                                "isSingle": false,
                                "pageSize": 10,
                                "quickSearchName": "",
                                "type": "57",
                                "viewAttr": 3
                            },
                            "colSpan": 2,
                            "conditionType": "BROWSER",
                            "domkey": [
                                "relatedshareid"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(106,"对象"),
                            "labelcol": 7,
                            "viewAttr": 3
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "INPUT_INTERVAL",
                            "needDefaultValue":false,
                            "domkey": [
                                "seclevel",
                                "seclevelMax"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(683,"安全级别"),
                            "labelcol": 7,
                            "value": [
                                0,
                                ''
                            ],
                            "viewAttr": 3
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "SELECT",
                            "domkey": [
                                "sharelevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(385,"权限"),
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "1",
                                    "selected": true,
                                    "showname": getLabel( 367 ,"查看")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname": getLabel( 93 ,"编辑")
                                }
                            ],
                            "viewAttr": 2
                        }
                    ]
                ],
                "5": [[
                        {
                            "browserConditionParam": {
                                "completeParams": {},
                                "conditionDataParams": {},
                                "dataParams": {},
                                "destDataParams": {},
                                "hasAddBtn": false,
                                "hasAdvanceSerach": true,
                                "idSeparator": ",",
                                "isAutoComplete": 1,
                                "isDetail": 0,
                                "isMultCheckbox": false,
                                "isSingle": false,
                                "pageSize": 10,
                                "quickSearchName": "",
                                "type": "194",
                                "viewAttr": 3
                            },
                            "colSpan": 2,
                            "conditionType": "BROWSER",
                            "domkey": [
                                "relatedshareid"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(106,"对象"),
                            "labelcol": 7,
                            "value": 3,
                            "viewAttr": 2
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "INPUT_INTERVAL",
                            "needDefaultValue":false,
                            "domkey": [
                                "seclevel",
                                "seclevelMax"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(683,"安全级别"),
                            "labelcol": 7,
                            "value": [
                                0,
                                ''
                            ],
                            "viewAttr": 3
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "SELECT",
                            "domkey": [
                                "sharelevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(385,"权限"),
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "1",
                                    "selected": true,
                                    "showname": getLabel( 367 ,"查看")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname": getLabel( 93 ,"编辑")
                                }
                            ],
                            "viewAttr": 2
                        }
                    ]
                ],
                "1": [[
                        {
                            "browserConditionParam": {
                                "completeParams": {},
                                "conditionDataParams": {},
                                "dataParams": {},
                                "destDataParams": {},
                                "hasAddBtn": false,
                                "hasAdvanceSerach": true,
                                "idSeparator": ",",
                                "isAutoComplete": 1,
                                "isDetail": 0,
                                "isMultCheckbox": false,
                                "isSingle": false,
                                "pageSize": 10,
                                "quickSearchName": "",
                                "type": "17",
                                "viewAttr": 3
                            },
                            "colSpan": 2,
                            "conditionType": "BROWSER",
                            "domkey": [
                                "relatedshareid"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(106,"对象"),
                            "labelcol": 7,
                            "viewAttr": 3
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "SELECT",
                            "domkey": [
                                "sharelevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(385,"权限"),
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "1",
                                    "selected": true,
                                    "showname": getLabel( 367 ,"查看")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname": getLabel( 93 ,"编辑")
                                }
                            ],
                            "viewAttr": 2
                        }
                    ]
                ],
                "11": [[
                        {
                            "browserConditionParam": {
                                "completeParams": {},
                                "conditionDataParams": {},
                                "dataParams": {},
                                "destDataParams": {},
                                "hasAddBtn": false,
                                "hasAdvanceSerach": true,
                                "idSeparator": ",",
                                "isAutoComplete": 1,
                                "isDetail": 0,
                                "isMultCheckbox": false,
                                "isSingle": false,
                                "pageSize": 10,
                                "quickSearchName": "",
                                "type": "278",
                                "viewAttr": 3
                            },
                            "colSpan": 2,
                            "conditionType": "BROWSER",
                            "domkey": [
                                "relatedshareid"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(106,"对象"),
                            "labelcol": 7,
                            "viewAttr": 3
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "SELECT_LINKAGE",
                            "domkey": [
                                "joblevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel( 28169 ,"岗位级别"),
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "0",
                                    "selected": true,
                                    "showname": getLabel( 140 ,"总部")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname": getLabel( 19437 ,"指定分部")
                                }, {
                                    "key": "1",
                                    "selected": false,
                                    "showname": getLabel( 19438 ,"指定部门")
                                }
                            ],
                            "selectLinkageDatas": {
                                "1": {
                                    "browserConditionParam": {
                                        "completeParams": {},
                                        "conditionDataParams": {},
                                        "dataParams": {},
                                        "destDataParams": {},
                                        "hasAddBtn": false,
                                        "hasAdvanceSerach": true,
                                        "idSeparator": ",",
                                        "isAutoComplete": 1,
                                        "isDetail": 0,
                                        "isMultCheckbox": false,
                                        "isSingle": false,
                                        "pageSize": 10,
                                        "quickSearchName": "",
                                        "type": "57",
                                        "viewAttr": 3
                                    },
                                    "colSpan": 2,
                                    "conditionType": "BROWSER",
                                    "domkey": [
                                        "jobtitledepartment"
                                    ],
                                    "fieldcol": 16,
                                    "isQuickSearch": false,
                                    "label": "",
                                    "labelcol": 7,
                                    "viewAttr": 3
                                },
                                "2": {
                                    "browserConditionParam": {
                                        "completeParams": {},
                                        "conditionDataParams": {},
                                        "dataParams": {},
                                        "destDataParams": {},
                                        "hasAddBtn": false,
                                        "hasAdvanceSerach": true,
                                        "idSeparator": ",",
                                        "isAutoComplete": 1,
                                        "isDetail": 0,
                                        "isMultCheckbox": false,
                                        "isSingle": false,
                                        "pageSize": 10,
                                        "quickSearchName": "",
                                        "type": "194",
                                        "viewAttr": 3
                                    },
                                    "colSpan": 2,
                                    "conditionType": "BROWSER",
                                    "domkey": [
                                        "jobtitlesubcompany"
                                    ],
                                    "fieldcol": 16,
                                    "isQuickSearch": false,
                                    "label": "",
                                    "labelcol": 7,
                                    "viewAttr": 3
                                }
                            },
                            "viewAttr": 2
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "SELECT",
                            "domkey": [
                                "sharelevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(385,"权限"),
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "1",
                                    "selected": true,
                                    "showname": getLabel( 367 ,"查看")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname": getLabel( 93 ,"编辑")
                                }
                            ],
                            "viewAttr": 2
                        }
                    ]
                ],
                "4": [[
                        {
                            "colSpan": 2,
                            "conditionType": "INPUT_INTERVAL",
                            "needDefaultValue":false,
                            "domkey": [
                                "seclevel",
                                "seclevelMax"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(683,"安全级别"),
                            "labelcol": 7,
                            "value": [
                                0,
                                ''
                            ],
                            "viewAttr": 3
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "SELECT",
                            "domkey": [
                                "sharelevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(385,"权限"),
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "1",
                                    "selected": true,
                                    "showname": getLabel( 367 ,"查看")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname": getLabel( 93 ,"编辑")
                                }
                            ],
                            "viewAttr": 2
                        }
                    ]
                ],
                "3": [[
                        {
                            "browserConditionParam": {
                                "completeParams": {},
                                "conditionDataParams": {},
                                "dataParams": {},
                                "destDataParams": {},
                                "hasAddBtn": false,
                                "hasAdvanceSerach": true,
                                "idSeparator": ",",
                                "isAutoComplete": 1,
                                "isDetail": 0,
                                "isMultCheckbox": false,
                                "isSingle": false,
                                "pageSize": 10,
                                "quickSearchName": "",
                                "type": "65",
                                "viewAttr": 3
                            },
                            "colSpan": 2,
                            "conditionType": "BROWSER",
                            "domkey": [
                                "relatedshareid"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(106,"对象"),
                            "labelcol": 7,
                            "viewAttr": 3
                        }, {
                            "colSpan": 2,
                            "conditionType": "SELECT",
                            "domkey": [
                                "rolelevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": "级别",
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "0",
                                    "selected": true,
                                    "showname": getLabel(124,"部门")
                                }, {
                                    "key": "1",
                                    "selected": false,
                                    "showname":  getLabel(141,"分部")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname":  getLabel(140,"总部")
                                }
                            ],
                            "viewAttr": 2
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "INPUT_INTERVAL",
                            "needDefaultValue":false,
                            "domkey": [
                                "seclevel",
                                "seclevelMax"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(683,"安全级别"),
                            "labelcol": 7,
                            "value": [
                                0,
                                ''
                            ],
                            "viewAttr": 3
                        }
                    ],[
                        {
                            "colSpan": 2,
                            "conditionType": "SELECT",
                            "domkey": [
                                "sharelevel"
                            ],
                            "fieldcol": 16,
                            "isQuickSearch": false,
                            "label": getLabel(385,"权限"),
                            "labelcol": 7,
                            "options": [
                                {
                                    "key": "1",
                                    "selected": true,
                                    "showname": getLabel( 367 ,"查看")
                                }, {
                                    "key": "2",
                                    "selected": false,
                                    "showname": getLabel( 93 ,"编辑")
                                }
                            ],
                            "viewAttr": 2
                        }
                    ]
                ]
            }
        ];
        if( appDetachDisableAll){
            let temp = shareCondition[0];
            temp.options.splice(5,1);	
            shareCondition[0] = temp ;
        }
        return (
        <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@vvg1mj`} datas={this.getRightMenu()} onClick={this.onRightMenuClick.bind(this)}  >
            <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@510vg4`}
                title={title}
                loading={loading}
                icon={<i className='icon-coms-fa' />}
                iconBgcolor='#f14a2d'
                buttons={this.getTopButtons()}
                buttonSpace={10}
                showDropIcon={true}
                dropMenuDatas={this.getRightMenu()}
                onDropMenuClick={this.onRightMenuClick.bind(this)} 
            >
                <WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@qnf6pj`} 
                    leftCom={<ListLeftTree ecId={`${this && this.props && this.props.ecId || ''}_ListLeftTree@mkq3o8`} listStore={cptSearchStore} initkey={"all"} />}
                    isNew={true}
                    showLeft={leftShow} 
                    onCollapse={(bool)=>{
                        showLeftTree(bool);
                    }}
                >
                    <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@6lgw76`}
                        buttonsAd={getAdButtons(cptSearchStore,form)}
                        searchType={['base','advanced']}
                        searchsBaseValue={formParams.name}
                        setShowSearchAd={bool=>{cptSearchStore.setShowSearchAd(bool)}}
                        hideSearchAd={()=> cptSearchStore.setShowSearchAd(false)}
                        searchsAd={
                            <div><Condition ecId={`${this && this.props && this.props.ecId || ''}_Condition@o24uxd`} listStore={cptSearchStore} form={form} onEnterSearch={this.onEnterSearch}></Condition></div>
                        }
                        showSearchAd={showSearchAd}
                        onSearch={v=>{cptSearchStore.doSearch()}}
                        onSearchChange={v=>{
                            if(cptSearchStore.form.has("name")){
                                cptSearchStore.appendFormFields({name:{value:v}})
                            }else{
                                cptSearchStore.form.add(v,{key:"name"})
                            }
                        }}
                    />
                        <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@se5204`} 
                            comsWeaTableStore={tableStore}
                            hasOrder={true}
                            needScroll={true}
                            tableWidth={this.tableWidth}
                            register_table={reLoad}
                            onOperatesClick={this.onOperatesClick}
                        />
                    </WeaLeftRightLayout>
                    <WeaAuth ecId={`${this && this.props && this.props.ecId || ''}_WeaAuth@xx3gd5`}
                        visible={shareStore.visible}
                        icon={'icon-coms-fa'}
                        iconBgcolor='#f14a2d'
                        conditions={toJS(shareCondition)}
                        title={getLabel(2112,'共享设置')}
                        onOk={v => {
                            cptSearchStore.addCptShare(v);
                            shareStore.handleShareDialog(false);
                        }}
                        onCancel={() => {
                            shareStore.handleShareDialog(false);
                        }}
                    />
                     {showEditDialog &&<CptEdit ecId={`${this && this.props && this.props.ecId || ''}_CptEdit@3k2tt3`} callBack={cptSearchStore.doSearch} contentStore={mineCptStore} isdata={conditiontype.isdata} />}
                     { showFlowModify && <CptRecordDialog ecId={`${this && this.props && this.props.ecId || ''}_CptRecordDialog@tr0z7p`} type={showType} visible={showFlowModify} contentStore={mineCptStore} />}
                </WeaTop>
        </WeaRightMenu>)

    }

    getTopButtons(){
        const {cptSearchStore} = this.props;
        const {rightMenu,tableStore} = cptSearchStore;
        let {selectedRowKeys} = tableStore;
       let btnArr = [];
       let that = this;
       const isDisabled = !(selectedRowKeys.length>0 && `${toJS(selectedRowKeys)}`);
       rightMenu && rightMenu.length>0 && toJS(rightMenu).map(m=>{
           m.isTop == '1' && btnArr.length < 4 && btnArr.push(
               <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@s2vsvk@${m.type}`} type="primary" 
                   disabled={isDisabled && m.isControl == "1"}
                   onClick={()=>{
                        if(m.type == "BTN_IMPORT_EXCEL"){ //导出Excel
                            cptSearchStore.cptExport();
                        }else if(m.type == "BTN_COLUMN"){ //显示定制列
                            cptSearchStore.onShowColumn();
                        }
                   }}>
                   {m.menuName}
               </Button>
           );
       });
       return btnArr;
    }

    getRightMenu(){
        const {cptSearchStore }= this.props;
        const {rightMenu} = cptSearchStore;
        let btnArr = [];
        rightMenu && rightMenu.length>0 && rightMenu.map(m=>{
            btnArr.push({
                icon: <i className={m.menuIcon} />,
                content: m.menuName
            })
        });
    	return btnArr
    }
    onRightMenuClick(key){
        const {cptSearchStore }= this.props;
        const {rightMenu} = cptSearchStore;
        let that = this;
        rightMenu &&  rightMenu.length>0  && rightMenu.map((m,i)=>{
        	if(Number(key) == i){
                let fn = m.menuFun.indexOf('this') >= 0 ? `${m.menuFun.split('this')[0]})` : m.menuFun;
                if(m.type == "BTN_SEARCH"){ //搜索
                    cptSearchStore.doSearch();
                }else if(m.type == "BTN_IMPORT_EXCEL"){ // 导出Excel
                    cptSearchStore.cptExport();
                }else if (m.type == "BTN_COLUMN") { //定制列
                    cptSearchStore.onShowColumn();
                }
            }
        });
    }
    tableWidth = (columns) => {
        let width = 0;
        let cols = 0;
        columns.map(col => {
          if (col.display === 'true') {
            let oldwidth = col.oldWidth || '10%';
            let widthInt = parseFloat(oldwidth.replace('%', ''));
            if (widthInt <= 0) {
              widthInt = 10;
            }
            width += widthInt;
            cols++
          }
        })
        //超过10列，才出现滚动条，width>100才出现滚动条
        if(cols<=10){
            width = 100 ;
        }
        return `${width}%`;
    }
    onOperatesClick=(record,index,operate,flag,argumentString)=>{
        const {cptSearchStore,mineCptStore} = this.props;
        const {saveCapitalId,shareStore} = cptSearchStore;
		let _href = operate && operate.href ? operate.href : "";
		let fn = _href.replace("javascript:","");
        fn = fn.substring(0,fn.indexOf('('));
        saveCapitalId(record.randomFieldId);
        let that = this;
		if(fn != ""){
			if("onGiveback"==fn){
				let params = {viewtype:'cptbackone',capitalid:record.randomFieldId}
				confirm({
                    title: getLabel(15172,'系统提示'),
					content: getLabel(83559,'您确认要归还吗?'),
					onOk() {
                        cptSearchStore.onGiveback(params);
					},
					onCancel() {},
				});
			}else if("onEdit"==fn){
                mineCptStore.showCptInfo(true,{capitalid:record.randomFieldId,viewtype:'edit'},);
			}else if("onModifyLog"==fn){
                mineCptStore.showCptFlowModify(true,{capitalid:record.randomFieldId},"modify");
			}else if("onFlow"==fn){
                mineCptStore.showCptFlowModify(true,{capitalid:record.randomFieldId},"flow");
			}else if("onShare"==fn){
                shareStore.handleShareDialog(true);
			}else if("onDel"==fn){
				confirm({
                    title: getLabel(15172,'系统提示'),
					content: getLabel(83600,'您确认要删除吗?'),
					onOk() {
                        cptSearchStore.onCptDel({viewtype:'cptdel',capitalid:record.randomFieldId},"list",that.updateLeftTree);
					},
					onCancel() {},
				});
			}
		}
    }
    updateLeftTree = ()=>{
        const {cptSearchStore} = this.props;
        cptSearchStore.initTreeDatas();
    }

    onEnterSearch = () =>{
        const {cptSearchStore} = this.props;
        cptSearchStore.doSearch();
        cptSearchStore.setShowSearchAd(false);
    }

}

export default WeaTools.tryCatch(React,
    props => <WeaErrorPage ecId={`${this && this.props && this.props.ecId || ''}_WeaErrorPage@ogg74n`} msg={ props.error ? props.error : getLabel( 383324,'对不起，该页面异常，请联系管理员' )} />,
    {error: ""}
)(SearchResult);